n = eval(input(""))
if n < 0 or int(n) != n:
    print("illegal input")
else:
    with open("text.txt", "r+") as text:
        count = 0
        flag = 0
        for item in text.readlines():
            if count == n:
                break
            count += 1

            if item[0] == "A":
                flag = 1
                print(item,end="")
    if flag == 0:
        print("not found")
